

export default class RoomController {

    static showStats(room: Room): void {
        // container 统计
        if (Game.time % 5 == 0) {

            //     const extensions = room[STRUCTURE_EXTENSION]
            //     console.log('max energy', extensions.length * 50 + 300)

            // let containersStats = ''
            // const containers = room[STRUCTURE_CONTAINER]
            // for (const name in containers) {
            //     containersStats += containers[name].store[RESOURCE_ENERGY] + ' | '
            // }
            // if (containersStats) {
            //     room.log('containers: ' + containersStats)
            // }

            // const links = room[STRUCTURE_LINK]
            // for (const name in links) {
            //     console.log(links[name], links[name].store[RESOURCE_ENERGY], links[name].cooldown)
            // }

            // upgrade 效率统计
            const controller = room.controller
            if (!controller.my || !controller.progress) return
            let tickIncreaseProgress
            if (room.memory.ctrlLastTickProgress) {
                tickIncreaseProgress = controller.progress - room.memory.ctrlLastTickProgress
            }
            room.memory.ctrlLastTickProgress = controller.progress
            if (tickIncreaseProgress) {
                const remainTick = controller.progressTotal / tickIncreaseProgress
                const remainMinutes = remainTick * 3 / 60
                room.log((controller.progress/controller.progressTotal*100).toFixed(1) + '% ' + tickIncreaseProgress + ' ' + remainMinutes)
            }
        }
    }

}
